﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;

namespace DataModels.Models
{
    public abstract class MTUHAReportBase : ModelBase
    {
        [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int Id { get; set; }

        [ForeignKey("ANCFormMetadata")]
        public int MetadataId { get; set; }
        public ANCFormMetadata ANCFormMetadata { get; set; }

        [ForeignKey("Facility"), StringLength(50)]
        public string FacilityCode { get; set; }
        public Facility Facility { get; set; }

        public System.DateTime ReportDate { get; set; }
        public bool LessThan20 { get; set; }

        [StringLength(1000)]
        public string Comments { get; set; }

        [DatabaseGenerated(DatabaseGeneratedOption.Computed)]
        public Nullable<int> Year { get; set; }

        [DatabaseGenerated(DatabaseGeneratedOption.Computed)]
        public Nullable<int> Month { get; set; }

        //public static object GetPropertyValue(this object obj, string propertyName)
        //{
        //    return obj.GetType()
        //        .GetProperties()
        //        .Single(p => p.Name == propertyName)
        //        .GetValue(obj, null);
        //}
    }
}
